package io.byte_stream;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class Demo07_Chinese {
    public static void main(String[] args) throws IOException {
        //extracted();字节流读取中文可能会出现乱码
        FileOutputStream fos = new FileOutputStream("zzz.txt");
        fos.write("穷且意坚不坠青云之志".getBytes());
        fos.write("\r\n".getBytes());
        fos.close();

    }

    private static void extracted() throws IOException {
        FileInputStream fis = new FileInputStream("添狗.txt");
        byte[] arr = new byte[1024 * 8];
        int len;

        while ((len = fis.read(arr)) != -1) {
            System.out.println(new String(arr, 0, len));
        }


        fis.close();
    }
}
